pkg-install-pre:
    pkg.installed:
        - names:
            - lzo
            - lzo-devel
            - openssl-devel
            - pam
            - pam-devel
            - pkcs11-helper
            - pkcs11-helper-devel

lzo-source-install:
    file.managed:
        - name: /usr/local/src/lzo-2.06.tar.gz
        - source: salt://openvpn/files/lzo-2.06.tar.gz
        - user: root
        - group: root
        - mode: 755
        - unless: test -f /usr/local/src/lzo-2.06.tar.gz

    cmd.run:
        - names:
            - cd /usr/local/src/ && tar -xf lzo-2.06.tar.gz && cd lzo-2.06 && ./configure --prefix=/usr/local/lzo && make && make install

openvpn-source-install:
    file.managed:
        - name: /usr/local/src/openvpn-2.2.2.tar.gz
        - source: salt://openvpn/files/openvpn-2.2.2.tar.gz
        - user: root
        - group: root
        - mode: 755
        - unless: test -f /usr/local/src/openvpn-2.2.2.tar.gz

    cmd.run:
        - names:
            - cd /usr/local/src && tar -xf openvpn-2.2.2.tar.gz && cd openvpn-2.2.2 && ./configure --prefix=/usr/local/openvpn --with-lzo-headers=/usr/local/lzo/include --with-lzo-lib=/usr/local/lzo/lib && make && make install
